﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ZhiHeng.OneCard.CommUtility
{
    public class ErrorCode
    {
        /// <summary>
        /// 操作成功
        /// </summary>
        public const int OK = 0;                            //操作成功
        /// <summary>
        /// 打开读卡器失败
        /// </summary>
        public const int ERR_OPEN_CARDREADER_FAIL = -1;     //打开读卡器失败
        /// <summary>
        /// 请求卡片失败
        /// </summary>
        public const int ERR_REQUEST_CARD_FAIL = -2;        //请求卡片失败
        /// <summary>
        /// 防冲突失败
        /// </summary>
        public const int ERR_ANTICOLL_FAIL = -3;            //防冲突失败
        /// <summary>
        /// 选卡失败
        /// </summary>
        public const int ERR_SELECT_CARD_FAIL = -4;         //选卡失败
        /// <summary>
        /// 扇区密钥认证失败
        /// </summary>
        public const int ERR_AUTHENTICATION_FAIL =-5;       //扇区密钥认证失败
        /// <summary>
        /// 读取M1块失败
        /// </summary>
        public const int ERR_READ_CARD_FAIL = -6;           //读取M1块失败
        /// <summary>
        /// 写M1块失败
        /// </summary>
        public const int ERR_WRITE_CARD_FAIL = -7;          //写M1块失败
        /// <summary>
        /// 打开卡片失败
        /// </summary>
        public const int ERR_OPEN_CARD_FAIL = -8;           //打开卡片失败
        /// <summary>
        /// 关闭卡片失败
        /// </summary>
        public const int ERR_CLOSE_CARD_FAIL = -9;          //关闭卡片失败
        /// <summary>
        /// PSAM卡复位失败
        /// </summary>
        public const int ERR_CPU_RESET_FAIL = -10;          //CPU卡复位失败
        /// <summary>
        /// PSAM协议包发送失败
        /// </summary>
        public const int ERR_CPU_APDU_FAIL = -11;           //CPU协议包发送失败
        /// <summary>
        /// PSAM卡下电失败
        /// </summary>
        public const int ERR_CPU_POWERDOWN_FAIL = -12;      //CPU卡下电失败
        /// <summary>
        /// 读卡器蜂鸣失败
        /// </summary>
        public const int ERR_BEEP_FAIL = -13;               //读卡器蜂鸣失败
        /// <summary>
        /// 未连接读卡器
        /// </summary>
        public const int ERR_NON_OPEN_CARDREADER = -14;     //未连接读卡器

        /// <summary>
        /// 卡未初始化
        /// </summary>
        public const int ERR_NON_INIT = -200;               //卡未初始化
        /// <summary>
        /// 读PSAM卡密钥文件失败
        /// </summary>
        public const int ERR_READ_PSAM_KEY_FAIL = -201;     //读PSAM卡密钥文件失败
        /// <summary>
        /// 卡未开户
        /// </summary>
        public const int ERR_NON_CARD_OPEN = -202;          //卡未开户
        /// <summary>
        /// 卡号不符
        /// </summary>
        public const int ERR_CARDID = -203;
        /// <summary>
        /// PSAM卡命令执行失败
        /// </summary>
        public const int ERR_CPU_COMM_FAIL = -204;

        /// <summary>
        /// 卡余额不足
        /// </summary>
        public const int ERR_CARD_NON_AMT = -205;
       
        /// <summary>
        /// 该卡已冻结
        /// </summary>
        public const short RET_CARD_FREEZED = -206;
       
        /// <summary>
        /// 卡已挂失
        /// </summary>
        public const short RET_CARD_LOSTED = -207;
        /// <summary>
        /// 卡已锁定
        /// </summary>
        public const short RET_CARD_LOCKED = -208;
       
        /// <summary>
        /// 卡已休眠
        /// </summary>
        public const short RET_CARD_UNACTIVED = -209;


        /// <summary>
        /// 块校验失败
        /// </summary>
        public const int ERR_BLOCK_VERIFY_FAIL = -300;      //块校验失败
        /// <summary>
        /// 交易额错误
        /// </summary>
        public const int ERR_TRANAMT = -301;                //交易额错误
        /// <summary>
        /// 处理异常
        /// </summary>
        public const int ERR_EXCEPTION = -302;              //发生异常
        /// <summary>
        /// 参数错误
        /// </summary>
        public const int ERR_PARAM_ERROR = -303;              
    }
}
